<?php 
use \PsiFramework\Classes\Util\UI\Printer;
use \PsiFramework\Classes\Util\UI\HTML;

$user = $response->getAttribute("user");
$lang = $response->getAttribute("lang");
$error = $response->getAttribute("error");
$message = $response->getAttribute("message");
?>
<article id="cont-princ" class="nocols">
<?php
if (!is_null($error) || !is_null($message)) {
?>
    <div class="bloc bloc-1">
        <?php
        if (!is_null($error)) {
        ?>
        <div class="error">
            <?php Printer::display($error); ?>
        </div>
        <?php
        }
        if (!is_null($message)) {
        ?>
        <div class="message">
            <?php Printer::display($message); ?>
        </div>
        <?php 
        }
        ?>
    </div>
<?php
}
?>
    <div class="bloc bloc-2">
        <h2>
            <?php Printer::display($languageManager->getText('PERSONAL_INFORMATION')); ?>
        </h2>
        <h3>
            <?php Printer::display($languageManager->getText('INVOICE_INFORMATION')); ?>
        </h3>
        <form
            class="userForm"
            action="<?php Printer::display(HTML::linkHref('action=SaveUser'));?>"
            method="POST"
            enctype="multipart/form-data">
            <input
                type="hidden"
                name="id"
                value="<?php Printer::display($user->getId()); ?>" />
            <input
                type="hidden"
                name="old_password"
                value="<?php Printer::display($user->getPassword()); ?>" />
            <fieldset class="typeLeft label required">
                <label for="lastNameBox" class="user">
                    <?php Printer::display($languageManager->getText("LAST_NAME")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="lastName"
                    id="lastNameBox"
                    value="<?php if ($user!=null && $user->getSurName() != null) Printer::display($user->getSurName()); ?>"
                    required="required" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="firstNameBox" class="user">
                    <?php Printer::display($languageManager->getText("FIRST_NAME")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="firstName"
                    id="firstNameBox"
                    value="<?php if ($user!=null && $user->getFirstName() != null) Printer::display($user->getFirstName()); ?>"
                    required="required" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="addressBox" class="user">
                    <?php Printer::display($languageManager->getText("ADDRESS")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="address"
                    id="addressBox"
                    value="<?php if ($user!=null && $user->getAddress() != null) Printer::display($user->getAddress()); ?>"
                    required="required" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="zipBox" class="user">
                    <?php Printer::display($languageManager->getText("ZIP_CODE")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="zipCode"
                    id="zipBox"
                    value="<?php if ($user!=null && $user->getZipCode() != null) Printer::display($user->getZipCode()); ?>"
                    required="required" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="cityBox" class="user">
                    <?php Printer::display($languageManager->getText("CITY")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="cityName"
                    id="cityBox"
                    value="<?php if ($user!=null && $user->getCityName() != null) Printer::display($user->getCityName()); ?>"
                    required="required" />
            </fieldset>
            <!--
            <fieldset class="typeLeft label required">
                <label for="telBox" class="user">
                    <?php Printer::display($languageManager->getText("TEL")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="tel"
                    id="telBox"
                    value="<?php if ($user!=null && $user->getTel() != null) Printer::display($user->getTel()); ?>"
                    required="required" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="tel2Box" class="user">
                    <?php Printer::display($languageManager->getText("TEL2")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="tel2"
                    id="tel2Box"
                    value="<?php if ($user!=null && $user->getTel2() != null) Printer::display($user->getTel2()); ?>"
                    required="required" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="faxBox" class="user">
                    <?php Printer::display($languageManager->getText("FAX")); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="text"
                    name="fax"
                    id="faxBox"
                    value="<?php if ($user!=null && $user->getFax() != null) Printer::display($user->getFax()); ?>"
                    required="required" />
            </fieldset>
            -->
            <h3>
                <?php Printer::display($languageManager->getText('CONNEXION_INFORMATION')); ?> :
            </h3>
            <fieldset class="typeLeft label required">
                <label for="emailBox" class="user">
                    <?php Printer::display($languageManager->getText("EMAIL")); ?> : 
                </label>
				<input type="hidden" name="email" value="<?php if ($user!=null && $user->getEmail() != null) Printer::display($user->getEmail()); ?>" />
                <input
                    class="firstInput user"
                    type="email"
                    name="email_disabled"
                    id="emailBox"
                    value="<?php if ($user!=null && $user->getEmail() != null) Printer::display($user->getEmail()); ?>"
                    required="required"
                    disabled="disabled" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="loginBox" class="user">
                    <?php Printer::display($languageManager->getText("LOGIN_NAME")); ?> : 
                </label>
				<input type="hidden" name="login" value="<?php if ($user!=null && $user->getLogin() != null) Printer::display($user->getLogin()); ?>" />
                <input
                    class="firstInput user"
                    type="text"
                    name="login_disabled"
                    id="loginBox"
                    value="<?php if ($user!=null && $user->getLogin() != null) Printer::display($user->getLogin()); ?>"
                    required="required"
                    disabled="disabled" />
            </fieldset>
            <fieldset class="typeLeft label">
                <label for="newPasswordBox" class="user">
                    <?php Printer::display($languageManager->getText('NEW_PASSWORD')); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="password"
                    name="new_password"
                    id="newPasswordBox"
                    value="" />
            </fieldset>
            <fieldset class="typeLeft label">
                <label for="confirmPasswordBox" class="user">
                <?php Printer::display($languageManager->getText('CONFIRM_NEW_PASSWORD')); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="password"
                    name="confirm_new_password"
                    id="confirmPasswordBox"
                    value="" />
            </fieldset>
            <fieldset class="typeLeft label required">
                <label for="confirmOldPasswordBox" class="user">
                    <?php Printer::display($languageManager->getText('ENTER_PASSWORD')); ?> : 
                </label>
                <input
                    class="firstInput user"
                    type="password"
                    name="confirm_old_password"
                    id="confirmOldPasswordBox"
                    value=""
                    required="required" />
            </fieldset>
            
            <hr />

            <fieldset class="floatRight">
                <input
                    type="reset"
                    name="reset"
                    value="<?php Printer::display($languageManager->getText('CANCEL')); ?>">
                <input
                    type="submit"
                    name="inscription"
                    value="<?php Printer::display($languageManager->getText('SAVE_MODIFICATIONS')); ?>">
            </fieldset>
        </form>
    </div>
</article>
